//
//  WmcRecognitionSingleOptionCell.swift
//  YPWatermarkCamera
//
//  Created by 周诗松 on 2022/10/21.
//

import UIKit

class WmcRecognitionSingleOptionCell: WmcBaseCollectionCell {
    
    override func makeUI() {
        contentView.addSubview(textLabel)
        
        textLabel.snp.makeConstraints { make in
            make.left.top.right.bottom.equalToSuperview()
        }
    }
    
    private lazy var textLabel: UILabel = {
        let label: UILabel = UILabel()
        label.font = UIFont.systemFont(ofSize: 14, weight: .medium)
        label.textAlignment = .center
        label.textColor = .wmc_white_FFFFFF
        label.backgroundColor = .wmc_blue_5290FD
        label.layer.borderColor = UIColor.wmc_blue_5290FD.cgColor
        label.layer.borderWidth = 1
        label.layer.cornerRadius = 8.0
        label.layer.masksToBounds = true
        return label
    }()
    
    func updateText(_ text: String, isSelected: Bool, isEnable: Bool) {
        textLabel.text = text
        setSelected(isSelected, isEnable: isEnable)
    }
    
    private func setSelected(_ isSelected: Bool, isEnable: Bool) {
        if isSelected {
            textLabel.textColor = .wmc_white_FFFFFF
            if isEnable {
                textLabel.backgroundColor = .wmc_blue_5290FD
                textLabel.layer.borderColor = UIColor.wmc_blue_5290FD.cgColor
            } else {
                textLabel.backgroundColor = .wmc_grayH13_ACAEAF
                textLabel.layer.borderColor = UIColor.wmc_grayH13_ACAEAF.cgColor
            }
        } else {
            textLabel.backgroundColor = .wmc_white_FFFFFF
            if isEnable {
                textLabel.textColor = .wmc_blue_5290FD
                textLabel.layer.borderColor = UIColor.wmc_blue_5290FD.cgColor
            } else {
                textLabel.textColor = .wmc_grayH13_ACAEAF
                textLabel.layer.borderColor = UIColor.wmc_grayH13_ACAEAF.cgColor
            }
        }
    }
}
